﻿using Mr.Wang.FileLog.LogEnum;
using Mr.Wang.FileLog.LogInterface;
using System;
using System.Collections.Generic;
using System.Text;

namespace Mr.Wang.FileLog.LoggerEntity
{
    public class Logger : ILogger
    {
        public string LoggerName { get; private set; }
        public bool Enable { get; set; } = false;

        public Logger(string name)
        {
            this.LoggerName = name;
        }

        public void WriteLog(LogLeve logLeve, string mgs)
        {
            if (Enable)
            {
                LoggerManager.LogInfoEnQueue(new Model.LogInfo { CurlogLeve = logLeve, OccTime = DateTime.Now, LoggerName = LoggerName, Message = mgs });
            }
        }

        public void WriteInfoLog(string mgs)
        {
            WriteLog(LogLeve.Info, mgs);
        }
    }
}
